package cn.safekeeper.guide.admin.controller.monitor;

import cn.safekeeper.guide.admin.constant.MsgObj;
import cn.safekeeper.guide.admin.controller.BaseController;
import cn.safekeeper.guide.admin.domain.entity.SysLoginInfo;
import cn.safekeeper.guide.admin.domain.page.TableDataInfo;
import cn.safekeeper.guide.admin.service.ISysLoginInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 系统访问记录
 */
@RestController
@RequestMapping("/monitor/logininfor")
public class MonitorLoginInfoController extends BaseController {
    @Autowired
    private ISysLoginInfoService logininforService;

    @GetMapping("/list")
    public TableDataInfo list(SysLoginInfo logininfor) {
        startPage();
        List<SysLoginInfo> list = logininforService.selectLogininforList(logininfor);
        return getDataTable(list);
    }

    @DeleteMapping("/remove")
    public MsgObj remove(Long[] infoIds) {
        return toAjax(logininforService.deleteLogininforByIds(infoIds));
    }

    @DeleteMapping("/clean")
    public MsgObj clean() {
        logininforService.cleanLogininfor();
        return MsgObj.success();
    }
}
